//
//  NearbyModel.m
//  糗事百科
//
//  Created by 奚超明 on 16/5/31.
//  Copyright © 2016年 奚超明. All rights reserved.
//

#import "NearbyModel.h"

@implementation NearbyModel

+ (instancetype)nearbyWithDic:(NSDictionary *)dic
{
    NearbyModel *model = [[NearbyModel alloc] init];
    [model setValuesForKeysWithDictionary:dic];
    model.icon = [self iconUrlStringWithUid:[dic[@"uid"] stringValue] icon:dic[@"icon"]];
    return model;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

#pragma mark - 头像的拼接
+ (NSString *)iconUrlStringWithUid:(NSString *)uid icon:(NSString *)icon
{
    NSString *substring = [uid substringToIndex:uid.length/2];
    NSString *urlstring = [NSString stringWithFormat:@"%@/%@/medium/%@",substring,uid, icon];
    NSString *iconUrlString = [@"http://pic.qiushibaike.com/system/avtnew/" stringByAppendingString:urlstring];
    return iconUrlString;
}

@end
